package edu.njit.hz278.controller.patient;

import edu.njit.hz278.bean.Patient;
import edu.njit.hz278.core.db.IQuery;
import edu.njit.hz278.core.db.Query;
import edu.njit.hz278.core.web.Param;
import edu.njit.hz278.core.web.Post;

/**
 * 
 * @author Rivers Zhang
 *
 */
public class Update {
	private static final IQuery<Patient> queryForPatient = new Query<>(
			Patient.class);

	/**
	 * Inserts a patient.
	 * 
	 * @param patient
	 * @return
	 */
	@Post
	public Patient add(
			@Param(value = "patient", forceValid = true) Patient patient) {
		int pNum = queryForPatient.insert(patient);
		patient.setpNum(pNum);
		return patient;
	}
}
